package com.xiaomaoguai.redis.cluster;

import org.junit.Test;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;

import javax.annotation.Resource;
import java.util.concurrent.TimeUnit;

/**
 * @ FileName: SimplePubTestMain.java
 * @ Author: WeiHui-Z
 * @ Date: 2017/6/5 19:40
 * @ Version: v1.0.0
 */
@ContextConfiguration(locations = {"classpath:spring-jedis-cluster.xml"})
public class ClusterTest1Main extends AbstractJUnit4SpringContextTests {

    @Resource(name = "redisTemplate")
    private ValueOperations<String, Integer> valueOperations;

    @Test
    public void testPublishString() throws Exception {
        valueOperations.set("a", 1);
        do {
            valueOperations.increment("a", 1);
            System.out.println("a的值：" + valueOperations.get("a"));
            TimeUnit.SECONDS.sleep(5);
        } while (true);
    }

}
